package com.bexon.app.IO;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class OutputStreamDemo {

	public static void main(String[] args) {
		File file = new File("E:\\01.txt");
		
		writer01(file);
		
	}

	private static void writer01(File file) {
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(file);
			String str = "'Mobile Internet Application Technology' Class 1161";
			byte[] buff= str.getBytes();
			fos.write(buff);
			System.out.println("已将句子添加到文件。");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally{
			try {
				if(fos!=null){
					fos.close();
					fos = null;
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	

}
